from django.conf.urls.defaults import *

#import sys
#import os
#CURRENT_PATH = os.path.join(os.path.dirname(__file__))
#sys.path.extend([os.path.join(CURRENT_PATH, 'apps')])

from django.views.generic.simple import direct_to_template, redirect_to

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    (r'^widgets/', include ('widgets.urls')),
    (r'^kontakty/', include ('kontakty.urls')),
    (r'^admin/filebrowser/', include('filebrowser.urls')),
    (r'^admin/(.*)', admin.site.root),
    
    (r'^tinymce/', include('tinymce.urls')),
    (r'^forum/', include('diamandas.myghtyboard.URLconf')),
    
    url(r'^$', direct_to_template, {"template": "homepage.html"}, name="indeks"),
    (r'konto/', include('konto.urls')),
    (r'projekty/', include('projekty.urls')),
    url(r'wiki/', include('wiki.urls'), name="wiki"),
    (r'^blog/',include('blog.urls')),
    (r'^biblioteka/',include('biblioteka.urls')),
    #url(r'^kalendarz/$', direct_to_template, {"template": "google/kalendarz.html"}, name="kalendarz"),
    #url(r'^dokumenty/$', direct_to_template, {"template": "google/dokumenty.html"}, name="dokumenty"),
    (r'^dokumenty/$', include('dokumenty.urls')),
    url(r'^poczta/$', redirect_to, {"url": "http://mail.google.com/a/mediaframe.pl/#inbox"}, name="poczta"),
    url(r'^kalendarz/$', redirect_to, {"url": "http://www.google.com/calendar/hosted/mediaframe.pl/render"}, name="kalendarz"),
    url(r'^dokumenty/$', redirect_to, {"url": "http://docs.google.com/a/mediaframe.pl/?tab=co#all"}, name="dokumenty"),
)

import os.path
urlpatterns += patterns('',
    (r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
    {'document_root': os.path.join(os.path.dirname(__file__), "site_media")}),
    (r'^uploads/(?P<path>.*)$', 'django.views.static.serve',
    {'document_root': os.path.join(os.path.dirname(__file__), "site_media/uploads/anyuser")}),
)
